package com.apes.fn.misc.taskDownload;

import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

public interface TaskDownloadRepository extends CustomRepository<TaskDownload, String> {

    List<TaskDownload> findAllByMd5(String md5);

    @Query("select t from TaskDownload t where t.postId is not null and t.ftpName is null order by t.createDate")
    List<TaskDownload> findForFile();
    
    @Query("select t from TaskDownload t where t.createDate < :date and t.ftpName is not null order by t.createDate")
    List<TaskDownload> findAllForDelete(@Param("date") Date date);
}
